export function getDateDiff (dateTimeStamp) {
  dateTimeStamp = Date.parse(dateTimeStamp.replace(/-/gi, "/"))
  console.log("时间", dateTimeStamp)
  var minute = 1000 * 60;
  var hour = minute * 60;
  var day = hour * 24;
  var halfamonth = day * 15;
  var month = day * 30;
  var now = new Date().getTime();
  var diffValue = now - dateTimeStamp;
  if (diffValue < 0) { return; }
  var monthC = diffValue / month;
  var weekC = diffValue / (7 * day);
  var dayC = diffValue / day;
  var hourC = diffValue / hour;
  var minC = diffValue / minute;
  var result;
  if (monthC >= 1) {
    result = "" + parseInt(monthC) + "月前";
  }
  else if (weekC >= 1) {
    result = "" + parseInt(weekC) + "周前";
  }
  else if (dayC >= 1) {
    result = "" + parseInt(dayC) + "天前";
  }
  else if (hourC >= 1) {
    result = "" + parseInt(hourC) + "小时前";
  }
  else if (minC >= 1) {
    result = "" + parseInt(minC) + "分钟前";
  } else
    result = "刚刚";

  console.log("时间", result)
  return result;

}
export function getType (num) {
  var type;
  switch (num) {
    case 1:
      type = '招聘'
      break;
    case 2:
      type = '求职'
      break;
    case 3:
      type = '教育'
      break;
    case 4:
      type = '房屋'
      break;
    case 5:
      type = '生活'
      break;
    case 6:
      type = '闲置'
      break;
    case 7:
      type = '装修'
      break;
    case 8:
      type = '车辆'
      break;
    case 9:
      type = '宠物'
      break;
    case 10:
      type = '宣传'
      break;
    case 11:
      type = '帮助'
      break;
    default:
      type = ''
      break;
  }
  return type;
}